#ifndef _SETTINGS_H
#define _SETTINGS_H

// #define DEBUG


// Pixelbuffer
#define maxLetters 10
#define pixelBufferLength 32
#define UseFahrenheit false
#define DecimalSeparator ','


// LED Matrix
#define MAX7219_SEG_NUM 4  // The number of the segments. Change this for multiple matrices.
#define MAX7219_INTENSITY_LEVEL 0x4  // 0x00 .. 0x0f

#ifdef ARDUINO_AVR_NANO
  #define MAX7219_DIN     10 // pin 7 on the ATTiny85 Board, Pin D10 on Nano
  #define MAX7219_CS      9 // pin 6 on the ATTiny85 Board, Pin D9 on Nano
  #define MAX7219_CLK     8 // pin 5 on the ATTiny85 Board, Pin D8 on Nano
#else
  #define MAX7219_DIN     PB2 // pin 7 on the ATTiny85 Board, Pin D10 on Nano
  #define MAX7219_CS      PB1 // pin 6 on the ATTiny85 Board, Pin D9 on Nano
  #define MAX7219_CLK     PB0 // pin 5 on the ATTiny85 Board, Pin D8 on Nano
#endif

// Thermistor
#define SensorPin A2  // Pin 3 on ATTiny, A2 on Nano
#define PowerPin PB3  // Pin 2 on ATTiny, Pin D11 on Nano
//#define PowerPin 11  // in case PB3 somehow doesn't work on arduino nano
#define SampleTime  100// Sampling Time in ms. 100ms works well on US and Euro power nets
#define SensorPowerOnDelay 10  // Delay between power on of sensor and actual reading
#define ADC1V1RealVoltage 1.066  // the real value the 1V1 voltage reference of the ADC
#define mv_per_adc_unit 0.001041015625

/*
# short script to calculate data from measured voltage input on SensorPin
def calc_vref(vin:float, adc_units:float):
  vref = vin * (1024.0/adc_units)
  return vref

def show_vref(vals):
  avg = 0.0
  for vin in vals:
    result = calc_vref(vin, vals[vin])
    print(f'{vin}: {result}')
    avg += result
  
  avg /= len(vals)
  print(f'average: {avg}')

vals = {
0.1: 100,
0.2: 202.25,
0.3: 304.86,
0.4: 410,
0.5: 509.5,
0.6: 613,
0.7: 714,
0.8: 822,
0.9: 922,
1.0: 1022
}

show_vref(vals)
*/


#define ReferenceVoltage 1.241  // Vin at Voltage Divider
#define R1 9960  // Static Resistor on Voltage Divider
#define Beta 3486  // Beta of Thermistor
#define RBeta 28500  // Reference Value in Ohm
#define RBetaTemp 0  // Reference Value in Temperature (°C)


// other
#define MainloopTimePeriodMS 500  // run mainloop once per X milliseconds
#define ShowTempDelayCount 30  // Show Temperature for this many iterations of the mainloop before switching to Plot Display
#define ShowPlotDelayCount 10  // Show Plot for this many iterations of the mainloop before switching to Temperature Display
#define PlotUpdateCount 120 * 15  // update plot with new row of data after this x loop() calls
#define PlotStepPerPixel 0.5  // one pixel represents this amount of change in temperature in degrees celsius or fahrenheit, as selected
#define MinPlotColsBeforeSwitching 8  // minimum number of columns before temperature display mode switches to plot mode


/*
const byte Swastika[] = {24, 48, 38, 155, 217, 100, 12, 24};

const byte SiegHeil[] = {0, 0, 0, 0, 78, 219, 219, 114, 
                         0, 195, 255, 195, 0, 255, 219, 219, 
                         195, 0, 126, 195, 219, 123, 0, 0, 
                         0, 255, 24, 24, 255, 0, 255, 219, 
                         219, 195, 0, 195, 255, 195, 0, 255, 
                         192, 192, 192, 0, 223, 223, 0, 0, 
                         0, 0};

const byte Sieg[] = {0, 0, 0, 0, 0, 0, 0, 78, 
                     219, 219, 114, 0, 195, 255, 195, 0, 
                     255, 219, 219, 195, 0, 126, 195, 219, 
                     123, 0, 0, 0, 0, 0, 0, 0};

const byte Heil[] = {0, 0, 0, 0, 0, 0, 0, 255, 
                     24, 24, 255, 0, 255, 219, 219, 195, 
                     0, 195, 255, 195, 0, 255, 192, 192, 
                     192, 0, 0, 0, 0, 0, 0, 0,};

const byte Hitler[] = {0, 0, 255, 24, 24, 255, 0, 195, 
                      255, 195, 0, 7, 195, 255, 195, 7, 
                      0, 255, 192, 192, 224, 0, 255, 219, 
                      219, 195, 0, 255, 27, 59, 238, 0};
*/

#endif  //_SETTINGS_H


